﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AtomITBackupUtility
{
    public partial class NewBackup : Form
    {
        static public Backup m_NewBackupData;

        public NewBackup()
        {
            InitializeComponent();
        }

        private void NewBackup_Load(object sender, EventArgs e)
        {
            folderBrowserDialog.SelectedPath = "";
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if ((!string.IsNullOrEmpty(tbName.Text)) || (!string.IsNullOrEmpty(tbDest.Text)) || (!string.IsNullOrEmpty(tbSource.Text)))
            {
                m_NewBackupData.Name = tbName.Text;
                m_NewBackupData.Source = tbSource.Text;
                m_NewBackupData.Destination = tbDest.Text;
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Not all fields are complete");
            }
        }

        private void btnBrowseForSource_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.SelectedPath = "";

            folderBrowserDialog.ShowDialog(this);

            tbSource.Text = folderBrowserDialog.SelectedPath;
        }

        private void btnBrowseForDest_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.SelectedPath = "";

            folderBrowserDialog.ShowDialog(this);

            tbDest.Text = folderBrowserDialog.SelectedPath;
        }
    }
}
